package com.teach.util;

import com.teach.CodeException;

/**<pre>
 * jwt工具类
 * Class: com.teach.util.JwtUtil
 * Copyright 2022 jlzhou.top Inc. All rights reserved.
 * Warning: this content is only for internal circulation of the company.
 *          It is forbidden to divulge it or use it for other commercial purposes.
 * </pre>
 * @author J.L.Zhou
 * @since 2022年10月22日 下午1:53:38
 * @version 1.0
 */
public interface JwtUtil {
    /**
   * 创建jwt
   * @param payloads jwt内的负载信息对象
   * @return jwt字符串
   */
  String create(Object payloads);

  /**
   * 校验jwt字符串
   * @param jwt
   * @exception CodeException: 10-口令验证未通过,11-口令已过期
   */
  void verify(String jwt)throws CodeException;

  /**
   * 解析jwt字符串,获取负载信息对象
   * @param <T>
   * @param jwt
   * @param cls
   * @return
   */
  <T> T parse(String jwt,Class<T> cls);
}
